#include<iostream>
#include<unistd.h>
#include<cstdlib>
using namespace std;
int main(){
  pid_t id = fork();
  if(id == 0 ){
    while(1){
      cout<<"这是子进程，其进程pid为："<<getpid()<<"其进程ppid为:"<<getppid()<<endl;
      sleep(1);
    }
  }else{
  
      cout<<"这是父进程，其进程pid为："<<getpid()<<"其进程ppid为:"<<getppid()<<endl;
      exit(1);
  }
  return 0;
}
